{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "2a9bbd2c",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Chapter 1 启航 Getting Started"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c127a52",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 欢迎大家来到 P2S！\n",
    "\n",
    "迈出成为 AI 训练大师的第一步！\n",
    "\n",
    "![AI Master](./image/chap1/AIMaster.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "29684035",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 第一行代码\n",
    "Language C\n",
    "```c\n",
    "#include<stdio.h> \n",
    "int main(){\n",
    "    printf(\"Hello, World\");\n",
    "    return 0;\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9b187328",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:06:00.541312Z",
     "start_time": "2023-08-01T12:06:00.522313Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "聪明办法学Python\n"
     ]
    }
   ],
   "source": [
    "print(\"聪明办法学Python\") "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd326c5d",
   "metadata": {
    "cell_style": "split",
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "## Hello World 的由来\n",
    "\n",
    "![Brian Kernighan](./image/chap1/464px-Brian-Kernighan-2017.png)\n",
    "\n",
    "```c\n",
    "main( ) {\n",
    "    printf(\"hello, word\");\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ed2f3d24",
   "metadata": {
    "cell_style": "split"
   },
   "source": [
    "Brian Wilson Kernighan, 1972\n",
    "\n",
    "*A Tutorial Introduction to the Language B*\n",
    "\n",
    "Language B Version:\n",
    "```B\n",
    "main( ) {\n",
    "    extern a, b, c;\n",
    "    putchar(a); putchar(b); putchar(c); putchar('!*n');\n",
    "}\n",
    " \n",
    "a 'hell';\n",
    "b 'o, w';\n",
    "c 'orld';\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98ab00f4",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-10-07T15:24:26.944438Z",
     "start_time": "2022-10-07T15:24:26.925296Z"
    },
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 注释 Comment\n",
    "\n",
    "分类：\n",
    "- 单行注释，使用 `#` 开头\n",
    "- 多行注释，使用 `'''` 或 `\"\"\"` 包裹起来\n",
    "\n",
    "作用：\n",
    "- 注释主要是用于对代码进行**解释和说明**，可以提升代码的可读性\n",
    "- 注释并**不会被当做代码处理** # magic comment 除外\n",
    "\n",
    "> 程序员最讨厌的 10 件事：0. 别人的代码不写注释。 1. 给自己的代码写注释\n",
    "\n",
    "> 当初写这段代码的时候只有上帝和我知道它是干嘛的，现在只有上帝知道\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "07edb7b0",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "<big>单行注释</big>\n",
    "\n",
    "使用 `#` 开头，`#` 后面的内容不会被当做代码，只能写在一行中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b2e587f6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:17:35.632974Z",
     "start_time": "2023-08-01T12:17:35.628973Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Datawhale\n"
     ]
    }
   ],
   "source": [
    "print(\"Datawhale\") # for the learner，和学习者一起成长"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "57fe02d3",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:20:20.770933Z",
     "start_time": "2023-08-01T12:20:20.758933Z"
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "p2s\n"
     ]
    }
   ],
   "source": [
    "# learn python the smart way v2\n",
    "print(\"p2s\")\n",
    "# print(\"prepare to be smart\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e32c85b4",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "<big>多行注释</big>\n",
    "\n",
    "使用 `'''` 或 `\"\"\"` 包裹起来(头和尾都是 3 个)，**单引号（'）与双引号（\"）在 Python 中并无太大区别**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ea217736",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:19:23.353122Z",
     "start_time": "2023-09-15T16:19:23.350091Z"
    },
    "run_control": {
     "marked": false
    },
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "人生苦短，我用 Python\n"
     ]
    }
   ],
   "source": [
    "print(\"人生苦短，我用 Python\")\n",
    "'''\n",
    "Python is powerful... and fast;\n",
    "plays well with others;\n",
    "runs everywhere;\n",
    "is friendly & easy to learn;\n",
    "is Open.\n",
    "'''"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1f66b079",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 基础的控制台输出 Basic Console Output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3b45f07c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:25:45.236203Z",
     "start_time": "2023-08-01T12:25:45.219685Z"
    },
    "run_control": {
     "marked": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Datawhale\n"
     ]
    }
   ],
   "source": [
    "print(\"Datawhale\") # for the learner，和学习者一起成长"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0efdfb86",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "`print()` 的作用是将填入的内容显示在 Console 中，默认每次输入后会换行（等价于按了一次回车，或者 `\\n`）\n",
    "\n",
    "控制结尾的参数是 `end`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b3b799e6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:26:49.085898Z",
     "start_time": "2023-08-01T12:26:49.075379Z"
    },
    "slideshow": {
     "slide_type": ""
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data\n",
      "whale\n"
     ]
    }
   ],
   "source": [
    "print(\"Data\")\n",
    "print(\"whale\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "034f73ac",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:31:24.973652Z",
     "start_time": "2023-08-01T12:31:24.962653Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data*whale\n"
     ]
    }
   ],
   "source": [
    "print(\"Data\", end=\"*\")\n",
    "print(\"whale\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2814590d",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "`print()` 一次也可以输出多个内容，默认以空格分隔\n",
    "\n",
    "控制分隔的参数是 `sep`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4b9f9952",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:32:36.527785Z",
     "start_time": "2023-08-01T12:32:36.522778Z"
    },
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data whale\n"
     ]
    }
   ],
   "source": [
    "print(\"Data\",\"whale\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "2081dc12",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:33:04.772658Z",
     "start_time": "2023-08-01T12:33:04.758660Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data*whale\n"
     ]
    }
   ],
   "source": [
    "print(\"Data\", \"whale\", sep=\"*\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "227a467f",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "你甚至可以做**加法**和**乘法**！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "ebcf08a0",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:34:03.764234Z",
     "start_time": "2023-08-01T12:34:03.746227Z"
    },
    "cell_style": "split",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "p2sp2s////datadatadata\n"
     ]
    }
   ],
   "source": [
    "print(\"p2s\"*2,\"data\"*3, sep=\"/\"*4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "2d733e71",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:35:00.447015Z",
     "start_time": "2023-08-01T12:35:00.433016Z"
    },
    "cell_style": "split",
    "scrolled": false,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "DatawhaleP2S\n"
     ]
    }
   ],
   "source": [
    "print(\"Data\"+\"whale\"+\"P2S\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "53f2133a",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "### 一些更好玩的做法\n",
    "\n",
    "我们假设，"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e8c41160",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:20:23.524420Z",
     "start_time": "2023-09-15T16:20:23.521903Z"
    },
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [],
   "source": [
    "x = 1\n",
    "y = 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e778f892",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:20:25.602057Z",
     "start_time": "2023-09-15T16:20:25.598876Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "一个简单的数学问题：\"1 + 2 = ?\"，答案是 3！\n"
     ]
    }
   ],
   "source": [
    "print(f\"一个简单的数学问题：\\\"{x} + {y} = ?\\\"，答案是 {x+y}！\") # f-strings"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "080d4b9b",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "为了课程演示，我们编写了下面这些代码，你并不需要弄清楚它具体内容是什么，享受游戏的过程就好了 ;-)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a158be07",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:41:49.166481Z",
     "start_time": "2023-09-15T16:41:49.093149Z"
    },
    "scrolled": true,
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "269dca0cf8894f06b23ebf3a0cdb85a0",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(IntSlider(value=10, description='x', max=30, min=-10), IntSlider(value=20, description='…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<function __main__.f(x, y)>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from ipywidgets import interact\n",
    "def f(x, y):\n",
    "    print(f\"A simple math question: \\\"{x} + {y} = ?\\\", the answer is {x + y}!\")\n",
    "interact(f,x=10, y=20)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ad9a6841",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "如果我想**一次性输出很多行**？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "a9562933",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T12:44:06.600042Z",
     "start_time": "2023-08-01T12:44:06.584694Z"
    },
    "run_control": {
     "marked": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Python is powerful... and fast;\n",
      "plays well with others;\n",
      "runs everywhere;\n",
      "is friendly & easy to learn;\n",
      "is Open.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"\n",
    "Python is powerful... and fast;\n",
    "plays well with others;\n",
    "runs everywhere;\n",
    "is friendly & easy to learn;\n",
    "is Open.\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "100469fa",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-10-09T09:56:42.481166Z",
     "start_time": "2022-10-09T09:56:42.468288Z"
    },
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "## 如何秒杀马里奥题\n",
    "\n",
    "[洛谷 P1000 超级玛丽游戏](https://www.luogu.com.cn/problem/P1000)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "abdc08f7",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:02:38.392675Z",
     "start_time": "2023-09-15T16:02:38.388934Z"
    },
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "        <iframe\n",
       "            width=\"100%\"\n",
       "            height=\"600\"\n",
       "            src=\"https://www.luogu.com.cn/problem/P1000\"\n",
       "            frameborder=\"0\"\n",
       "            allowfullscreen\n",
       "            \n",
       "        ></iframe>\n",
       "        "
      ],
      "text/plain": [
       "<IPython.lib.display.IFrame at 0x18eda162290>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import IFrame\n",
    "IFrame('https://www.luogu.com.cn/problem/P1000', width=\"100%\", height=600)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "433baaef",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 错误 Error\n",
    "- 语法错误 Syntax Errors，不符合语法规范，代码根本**没有开始运行**\n",
    "- “运行时”错误 Runtime Errors，代码在**运行过程中出错**，也就是常说的“崩溃”（Crash）\n",
    "- 逻辑错误 Logical Errors，代码能够运行，且运行过程中没有出错，但是**不是想要的结果**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b245992c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:22:26.353994Z",
     "start_time": "2023-09-15T16:22:26.350825Z"
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "unterminated string literal (detected at line 2) (3098959924.py, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[6], line 2\u001b[1;36m\u001b[0m\n\u001b[1;33m    print(\"哦不！) # Error! 缺少结尾引号\u001b[0m\n\u001b[1;37m          ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m unterminated string literal (detected at line 2)\n"
     ]
    }
   ],
   "source": [
    "# 语法错误（在编译时出错，Python 并没有开始运行代码）\n",
    "print(\"哦不！) # Error! 缺少结尾引号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "0f31e579",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:22:29.727783Z",
     "start_time": "2023-09-15T16:22:29.698025Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "ename": "ZeroDivisionError",
     "evalue": "division by zero",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mZeroDivisionError\u001b[0m                         Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[7], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;66;03m# “运行时”错误（Python 开始运行代码，但是遇到了些问题）\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;241;43m1\u001b[39;49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[38;5;241;43m0\u001b[39;49m) \u001b[38;5;66;03m# Error! 0 被作为除数\u001b[39;00m\n",
      "\u001b[1;31mZeroDivisionError\u001b[0m: division by zero"
     ]
    }
   ],
   "source": [
    "# “运行时”错误（Python 开始运行代码，但是遇到了些问题）\n",
    "print(1/0) # Error! 0 被作为除数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "308ae46e",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:22:35.381857Z",
     "start_time": "2023-09-15T16:22:35.378188Z"
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2+2=5\n"
     ]
    }
   ],
   "source": [
    "# Logical Errors (Compiles and runs, but is wrong!)\n",
    "# 逻辑错误（能编译，能运行，但不是想要的结果）\n",
    "print(\"2+2=5\") # Error! 算错了！！！\n",
    "# 我们想要：4！"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "977bb358",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 基础的控制台输入 Basic Console Input\n",
    "\n",
    "`input()` 可以接收 Console 的输入，并**以字符串的形式返回**，你可以给定个字符串参数，它会先输出到 Console，再接收输入"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "c18d8f87",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:40:27.595982Z",
     "start_time": "2023-09-15T16:40:22.519188Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的名字：Datawhale\n",
      "あなたの名前は Datawhale です\n"
     ]
    }
   ],
   "source": [
    "name = input(\"输入你的名字：\")\n",
    "print(\"あなたの名前は\", name, \"です\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "56608fe8",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "##  注意！返回的格式是字符串"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "37d10260",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:40:38.427010Z",
     "start_time": "2023-09-15T16:40:35.275473Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入一个数字: 10\n"
     ]
    },
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for /: 'str' and 'int'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[9], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m x \u001b[38;5;241m=\u001b[39m \u001b[38;5;28minput\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m输入一个数字: \u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(x, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m的一半等于\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[43mx\u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[38;5;241;43m2\u001b[39;49m) \u001b[38;5;66;03m# Error!\u001b[39;00m\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for /: 'str' and 'int'"
     ]
    }
   ],
   "source": [
    "x = input(\"输入一个数字: \")\n",
    "print(x, \"的一半等于\", x/2) # Error!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "06f9303d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:41:01.063366Z",
     "start_time": "2023-09-15T16:40:59.194739Z"
    },
    "run_control": {
     "marked": false
    },
    "scrolled": true,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入一个数字: 10\n",
      "10 的一半等于 5.0\n"
     ]
    }
   ],
   "source": [
    "x = input(\"输入一个数字: \")\n",
    "x = int(x) # 类型转换 float(x)\n",
    "# x = int(input(\"输入一个数字：\"))\n",
    "print(x, \"的一半等于\", x/2) # 对味啦"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "99cb167e",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "### 一行多个输入值\n",
    "\n",
    "1 -> a，2 -> b\n",
    "\n",
    "可以在结尾加上 `split()`，默认分隔参数是空格，可以更改，如：`split(\",\")`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "418507a6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:41:35.348051Z",
     "start_time": "2023-09-15T16:41:30.871204Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 2\n",
      "a = 1, b = 2\n"
     ]
    }
   ],
   "source": [
    "a, b = input().split()\n",
    "print(f\"a = {a}, b = {b}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "185616e3",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 导入模块\n",
    "Python 中有许多强大的工具箱，我们把它们叫做**“库”（Library）**，课程后期会介绍更多强大的工具\n",
    "\n",
    "库需要使用 `import` 来导入，并且使用 `xx.yy`的方式来调用，我们今天只作粗略介绍"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "68f87dda",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "以 Python 内置数学库 `math` 为例："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c75a0539",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:23:44.738984Z",
     "start_time": "2023-09-15T16:23:44.342009Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'math' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[1], line 2\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;66;03m# 阶乘 factorial\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mmath\u001b[49m\u001b[38;5;241m.\u001b[39mfactorial(\u001b[38;5;241m20\u001b[39m))\n",
      "\u001b[1;31mNameError\u001b[0m: name 'math' is not defined"
     ]
    }
   ],
   "source": [
    "# 阶乘 factorial\n",
    "print(math.factorial(20))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "02ce973d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:41:59.137297Z",
     "start_time": "2023-09-15T16:41:59.131301Z"
    },
    "run_control": {
     "marked": false
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6\n"
     ]
    }
   ],
   "source": [
    "import math # 使用库前要先导入！\n",
    "print(math.factorial(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2794774d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T13:09:36.887379Z",
     "start_time": "2023-08-01T13:09:36.878388Z"
    },
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "outputs": [],
   "source": [
    "# Euler 常数\n",
    "print(math.e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cf497dd5",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-08-01T13:10:06.054647Z",
     "start_time": "2023-08-01T13:10:06.034651Z"
    },
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "outputs": [],
   "source": [
    "# gcd 最大公约数\n",
    "math.gcd(12, 36)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1d91622c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-09-15T16:42:02.081955Z",
     "start_time": "2023-09-15T16:42:02.070288Z"
    },
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e4ba700850414beeae5cc9e46380bd95",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(IntSlider(value=30, description='x', max=90, min=-30), Output()), _dom_classes=('widget-…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<function __main__.f(x)>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def f(x):\n",
    "    a = x*(math.pi/180)\n",
    "    print(math.sin(a))\n",
    "interact(f,x=30)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "48832482",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "## 补充资料\n",
    "0.1+0.2≠0.3?? 无可避免的浮点误差：<https://www.bilibili.com/video/BV1xq4y1D7Ep>\n",
    "\n",
    "<iframe src=\"//player.bilibili.com/player.html?aid=590031661&bvid=BV1xq4y1D7Ep&cid=396310990&p=1danmaku=0&autoplay=0&hideDanmakuButton=1\" allowfullscreen=\"allowfullscreen\" width=\"100%\" height=\"500\" scrolling=\"no\" frameborder=\"0\" sandbox=\"allow-top-navigation allow-same-origin allow-forms allow-scripts\"></iframe>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0b79d003",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## 总结\n",
    "\n",
    "- 写注释是个好习惯\n",
    "- 调整输入输出的参数来控制其呈现效果\n",
    "- 大部分错误类型可以归为：语法错误、运行时错误和逻辑错误\n",
    "- Python 的库能让很多操作变方便"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Slideshow",
  "gist": {
   "data": {
    "description": "slide/chapter_1-Getting_Started.ipynb",
    "public": false
   },
   "id": ""
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  },
  "rise": {
   "overlay": "<div class='my-top-right'><img height=40px src='../resources/datawhale_logo.png'/></div><div class='my-top-left'></div>"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {
     "003e2839405643178ad12e3f7dcf80a7": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_81e59674f08446e5b134291b7ae87207",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "0.49999999999999994\n"
        }
       ]
      }
     },
     "018a4034db1740078a28b8657b564ee9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "y",
       "layout": "IPY_MODEL_81117538a7204835af525956b6952657",
       "max": 60,
       "min": -20,
       "style": "IPY_MODEL_7f27186ea90b4363ba8da4c634fad959",
       "value": 20
      }
     },
     "044d5538d41940ab9acd4ef27b5738ac": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "y",
       "layout": "IPY_MODEL_05e0910f4e2140738dff3770f09e9222",
       "max": 60,
       "min": -20,
       "style": "IPY_MODEL_06339b6d09b447ee90676a6468d01266",
       "value": 20
      }
     },
     "05e0910f4e2140738dff3770f09e9222": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "06339b6d09b447ee90676a6468d01266": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "06597f52cd07407e84da8c413e830790": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_2b7b8c5874ce45c5a91ad81e8ff676b8",
        "IPY_MODEL_36e658d568eb4f7e95e86585379006b6",
        "IPY_MODEL_6e21045934b347c3811088107f6d68eb"
       ],
       "layout": "IPY_MODEL_3d088011a8164153ade0eda07733a6d8"
      }
     },
     "0669fc56ae8b408e921beba3520f6d14": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "08706438180f435da3bb6764b59ab88f": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "1029279f289a4c81bcf47c59bc2272c0": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "124c0a2197ad4d01a66a3510523d6bab": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_a540171b24ce4763b108471cb1020a82",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "A simple math question: \"10 + 20 = ?\", the answer is 30!\n"
        }
       ]
      }
     },
     "141e098668fe4416ab5cbee6d09464d5": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "146ec45be8cb4288ab2a261a3bdc90cd": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "19b830f2dbd042e49e2cc475f730e733": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_92c7ee7359014d4e84ab0eb3847896b7",
       "max": 90,
       "min": -30,
       "style": "IPY_MODEL_aca0df7dd525439da4fbb3c85ec74a2f",
       "value": 30
      }
     },
     "1e65cb9cf136405db061cd4ec5281068": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "213b6906ace74617a0a7c37f7fe80e33": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "269dca0cf8894f06b23ebf3a0cdb85a0": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_e612fa032644456599e7c058fe83441c",
        "IPY_MODEL_36a8013c542a4331a7f6ebe43e7c24b9",
        "IPY_MODEL_e7e8154648c04623b0ddece5ab4c19c4"
       ],
       "layout": "IPY_MODEL_52e35c053286418d9fe5ada68a6c9a52"
      }
     },
     "2727ceebd04c4d3ab4db4e2dbfc64fa7": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_c1224ebc63a94fc0bf02592c6de76673",
       "outputs": [
        {
         "ename": "NameError",
         "evalue": "name 'math' is not defined",
         "output_type": "error",
         "traceback": [
          "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
          "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
          "File \u001b[1;32m~\\miniconda3\\envs\\p2s\\Lib\\site-packages\\ipywidgets\\widgets\\interaction.py:240\u001b[0m, in \u001b[0;36minteractive.update\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m    238\u001b[0m     value \u001b[38;5;241m=\u001b[39m widget\u001b[38;5;241m.\u001b[39mget_interact_value()\n\u001b[0;32m    239\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkwargs[widget\u001b[38;5;241m.\u001b[39m_kwarg] \u001b[38;5;241m=\u001b[39m value\n\u001b[1;32m--> 240\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mf\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    241\u001b[0m show_inline_matplotlib_plots()\n\u001b[0;32m    242\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mauto_display \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
          "Cell \u001b[1;32mIn[4], line 2\u001b[0m, in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mf\u001b[39m(x):\n\u001b[1;32m----> 2\u001b[0m     a \u001b[38;5;241m=\u001b[39m x\u001b[38;5;241m*\u001b[39m(\u001b[43mmath\u001b[49m\u001b[38;5;241m.\u001b[39mpi\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m180\u001b[39m)\n\u001b[0;32m      3\u001b[0m     \u001b[38;5;28mprint\u001b[39m(math\u001b[38;5;241m.\u001b[39msin(a))\n",
          "\u001b[1;31mNameError\u001b[0m: name 'math' is not defined"
         ]
        }
       ]
      }
     },
     "2b763158a5e74331b3cc64f730e12ada": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "2b7b8c5874ce45c5a91ad81e8ff676b8": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_b0a8761742ad411994f4968b110a7c5c",
       "max": 30,
       "min": -10,
       "style": "IPY_MODEL_30074bf89bae455899db34859ee5dec4",
       "value": 10
      }
     },
     "2edda18376d24e9f9a385cbfaede7ffe": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_1e65cb9cf136405db061cd4ec5281068",
       "max": 90,
       "min": -30,
       "style": "IPY_MODEL_88bc243b5c4d457f9a88ab47a92adfc0",
       "value": 30
      }
     },
     "30074bf89bae455899db34859ee5dec4": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "30c6c6a8026a475fa022433c08b69516": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "36a8013c542a4331a7f6ebe43e7c24b9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "y",
       "layout": "IPY_MODEL_993be00b43bf4685ae6fd529f78c437f",
       "max": 60,
       "min": -20,
       "style": "IPY_MODEL_4ea5c43e0f3e442aa8afe850ab2f4ce2",
       "value": 20
      }
     },
     "36e658d568eb4f7e95e86585379006b6": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "y",
       "layout": "IPY_MODEL_85aa9195bd6f402ab20f7999aba1c02f",
       "max": 60,
       "min": -20,
       "style": "IPY_MODEL_6b716bc3263f47d8a21bb7f2b5c35620",
       "value": 20
      }
     },
     "3701e13c50e640929bde5fc742abc50a": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_f547b163776f400f88246dd3034af06d",
        "IPY_MODEL_003e2839405643178ad12e3f7dcf80a7"
       ],
       "layout": "IPY_MODEL_7599cb8f58d2491f804cdc405d3b3de0"
      }
     },
     "3d088011a8164153ade0eda07733a6d8": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "44f20e4143974f4a98677aef404da584": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "y",
       "layout": "IPY_MODEL_b14b5a1e63b14da8ac763e094cfbe97d",
       "max": 60,
       "min": -20,
       "style": "IPY_MODEL_146ec45be8cb4288ab2a261a3bdc90cd",
       "value": 20
      }
     },
     "4c93be31d4f64faf9f731ec379484394": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_a84e9e66a9de401783a2a41d817fbc73",
        "IPY_MODEL_018a4034db1740078a28b8657b564ee9",
        "IPY_MODEL_e7bc41997974427d8f95d8f330e99fd6"
       ],
       "layout": "IPY_MODEL_e66005c43b3f46a0b009c97bf618e598"
      }
     },
     "4ea5c43e0f3e442aa8afe850ab2f4ce2": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "523f2d75879a44db95663bb6436dd05d": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "52bc603adc694f558a39258ec1e76156": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_f2870f8d10d34b3f96d42559e9daa2bb",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "A simple math question: \"10 + 20 = ?\", the answer is 30!\n"
        }
       ]
      }
     },
     "52e35c053286418d9fe5ada68a6c9a52": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "5fa97c4bec854976bea24b77f24070c7": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_81c927ff342f4a4cba245c79187c61e9",
        "IPY_MODEL_044d5538d41940ab9acd4ef27b5738ac",
        "IPY_MODEL_124c0a2197ad4d01a66a3510523d6bab"
       ],
       "layout": "IPY_MODEL_889c5c66d5814484beb27a66b0174c0c"
      }
     },
     "60844ca57adf403dbd6b4cd4b8578e15": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "624dfe9850d144ad9468b136f81836ac": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_9e1f9f69004e4eb2a03bb8a2ba778b56",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "0.49999999999999994\n"
        }
       ]
      }
     },
     "641a6c1f56804936b1b1bedade7b150a": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "66d3651cf7d348258af6469f1b3ed9f5": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "678ba426d84c4ec7bc3beb019cb56ecc": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_dcfb47f03e3a4038a20e41b06a6708d7",
       "outputs": [
        {
         "ename": "NameError",
         "evalue": "name 'math' is not defined",
         "output_type": "error",
         "traceback": [
          "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
          "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
          "File \u001b[1;32m~\\miniconda3\\envs\\p2s\\Lib\\site-packages\\ipywidgets\\widgets\\interaction.py:240\u001b[0m, in \u001b[0;36minteractive.update\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m    238\u001b[0m     value \u001b[38;5;241m=\u001b[39m widget\u001b[38;5;241m.\u001b[39mget_interact_value()\n\u001b[0;32m    239\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkwargs[widget\u001b[38;5;241m.\u001b[39m_kwarg] \u001b[38;5;241m=\u001b[39m value\n\u001b[1;32m--> 240\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mf\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    241\u001b[0m show_inline_matplotlib_plots()\n\u001b[0;32m    242\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mauto_display \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
          "Cell \u001b[1;32mIn[5], line 2\u001b[0m, in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mf\u001b[39m(x):\n\u001b[1;32m----> 2\u001b[0m     a \u001b[38;5;241m=\u001b[39m x\u001b[38;5;241m*\u001b[39m(\u001b[43mmath\u001b[49m\u001b[38;5;241m.\u001b[39mpi\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m180\u001b[39m)\n\u001b[0;32m      3\u001b[0m     \u001b[38;5;28mprint\u001b[39m(math\u001b[38;5;241m.\u001b[39msin(a))\n",
          "\u001b[1;31mNameError\u001b[0m: name 'math' is not defined"
         ]
        }
       ]
      }
     },
     "67c6bb383b644c0b9abc04c9ae4e6a62": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "6b4960d6f772462a9fc60708228db0d9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "6b716bc3263f47d8a21bb7f2b5c35620": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "6bf3f884e4d74eb586c53fcbe3e9abc9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_e1cc64874464438abb96fec8a95aa869",
        "IPY_MODEL_678ba426d84c4ec7bc3beb019cb56ecc"
       ],
       "layout": "IPY_MODEL_8192b9da66694d8aa5618cc9cda5b773"
      }
     },
     "6e21045934b347c3811088107f6d68eb": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_641a6c1f56804936b1b1bedade7b150a",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "A simple math question: \"10 + 20 = ?\", the answer is 30!\n"
        }
       ]
      }
     },
     "7599cb8f58d2491f804cdc405d3b3de0": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "76b8d887ee1a4485a5f518048cc66ef3": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_1029279f289a4c81bcf47c59bc2272c0",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "0.49999999999999994\n"
        }
       ]
      }
     },
     "7a3f61f49c674aef9cf11ed88bfa5ae0": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "7f27186ea90b4363ba8da4c634fad959": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "81117538a7204835af525956b6952657": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "81485a719b1c4047a55aa4f9469eb9a2": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "8192b9da66694d8aa5618cc9cda5b773": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "81c927ff342f4a4cba245c79187c61e9": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_9be37d9cc818487e869ab8f8d369f7c7",
       "max": 30,
       "min": -10,
       "style": "IPY_MODEL_ab2a6b587c1d4402b19f4b70e055bddb",
       "value": 10
      }
     },
     "81e59674f08446e5b134291b7ae87207": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "85aa9195bd6f402ab20f7999aba1c02f": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "86406453427a4fa48c5dda21b9e532a7": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "87f892e3b1d24f95b46957bfcaef9745": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "8862a778f5204d79881549d3b25222b5": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "889c5c66d5814484beb27a66b0174c0c": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "88bc243b5c4d457f9a88ab47a92adfc0": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "8ef4554089b244a98bd458181b3ba478": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_f3a4cf71e0c546dbbdd3b710356a4015",
        "IPY_MODEL_44f20e4143974f4a98677aef404da584",
        "IPY_MODEL_52bc603adc694f558a39258ec1e76156"
       ],
       "layout": "IPY_MODEL_86406453427a4fa48c5dda21b9e532a7"
      }
     },
     "9101e470ea6c4347821f91be97ff7e06": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_19b830f2dbd042e49e2cc475f730e733",
        "IPY_MODEL_2727ceebd04c4d3ab4db4e2dbfc64fa7"
       ],
       "layout": "IPY_MODEL_213b6906ace74617a0a7c37f7fe80e33"
      }
     },
     "92c7ee7359014d4e84ab0eb3847896b7": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "943ad1388fb74af699f24bd50ce4e0e2": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_2edda18376d24e9f9a385cbfaede7ffe",
        "IPY_MODEL_624dfe9850d144ad9468b136f81836ac"
       ],
       "layout": "IPY_MODEL_60844ca57adf403dbd6b4cd4b8578e15"
      }
     },
     "993be00b43bf4685ae6fd529f78c437f": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "9be37d9cc818487e869ab8f8d369f7c7": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "9d2b6656488841528dc63d972cb10b07": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "9e1f9f69004e4eb2a03bb8a2ba778b56": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "a2d2a727328940ec907c08a108419005": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_b565f1d91b3b4939bc9296922d6b4e32",
       "max": 90,
       "min": -30,
       "style": "IPY_MODEL_6b4960d6f772462a9fc60708228db0d9",
       "value": 30
      }
     },
     "a540171b24ce4763b108471cb1020a82": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "a84e9e66a9de401783a2a41d817fbc73": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_7a3f61f49c674aef9cf11ed88bfa5ae0",
       "max": 30,
       "min": -10,
       "style": "IPY_MODEL_66d3651cf7d348258af6469f1b3ed9f5",
       "value": 10
      }
     },
     "ab2a6b587c1d4402b19f4b70e055bddb": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "aca0df7dd525439da4fbb3c85ec74a2f": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "b0a8761742ad411994f4968b110a7c5c": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "b14b5a1e63b14da8ac763e094cfbe97d": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "b1c71a66e65c4e539299ff2ed65f20c9": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "b2c1fb0127ed4642ab959be57b91ab27": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "b565f1d91b3b4939bc9296922d6b4e32": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "c1224ebc63a94fc0bf02592c6de76673": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "cf7ece74bf4d47ed8ee83febc744aedb": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "SliderStyleModel",
      "state": {
       "description_width": ""
      }
     },
     "d596c866cd3b4e5b9cca17504c9b5db7": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_a2d2a727328940ec907c08a108419005",
        "IPY_MODEL_da59898e684a49bca2ded9f82b9de4a7"
       ],
       "layout": "IPY_MODEL_b1c71a66e65c4e539299ff2ed65f20c9"
      }
     },
     "da59898e684a49bca2ded9f82b9de4a7": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_08706438180f435da3bb6764b59ab88f",
       "outputs": [
        {
         "ename": "NameError",
         "evalue": "name 'math' is not defined",
         "output_type": "error",
         "traceback": [
          "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
          "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
          "File \u001b[1;32m~\\miniconda3\\envs\\p2s\\Lib\\site-packages\\ipywidgets\\widgets\\interaction.py:240\u001b[0m, in \u001b[0;36minteractive.update\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m    238\u001b[0m     value \u001b[38;5;241m=\u001b[39m widget\u001b[38;5;241m.\u001b[39mget_interact_value()\n\u001b[0;32m    239\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkwargs[widget\u001b[38;5;241m.\u001b[39m_kwarg] \u001b[38;5;241m=\u001b[39m value\n\u001b[1;32m--> 240\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mf\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m    241\u001b[0m show_inline_matplotlib_plots()\n\u001b[0;32m    242\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mauto_display \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresult \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
          "Cell \u001b[1;32mIn[10], line 2\u001b[0m, in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mf\u001b[39m(x):\n\u001b[1;32m----> 2\u001b[0m     a \u001b[38;5;241m=\u001b[39m x\u001b[38;5;241m*\u001b[39m(\u001b[43mmath\u001b[49m\u001b[38;5;241m.\u001b[39mpi\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m180\u001b[39m)\n\u001b[0;32m      3\u001b[0m     \u001b[38;5;28mprint\u001b[39m(math\u001b[38;5;241m.\u001b[39msin(a))\n",
          "\u001b[1;31mNameError\u001b[0m: name 'math' is not defined"
         ]
        }
       ]
      }
     },
     "dcfb47f03e3a4038a20e41b06a6708d7": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "dda5586889234abeb45556613f323c16": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "e1aafd9d805f45ceb2a5a394322f71e4": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_2b763158a5e74331b3cc64f730e12ada",
       "max": 90,
       "min": -30,
       "style": "IPY_MODEL_cf7ece74bf4d47ed8ee83febc744aedb",
       "value": 30
      }
     },
     "e1cc64874464438abb96fec8a95aa869": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_8862a778f5204d79881549d3b25222b5",
       "max": 90,
       "min": -30,
       "style": "IPY_MODEL_141e098668fe4416ab5cbee6d09464d5",
       "value": 30
      }
     },
     "e4ba700850414beeae5cc9e46380bd95": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "VBoxModel",
      "state": {
       "_dom_classes": [
        "widget-interact"
       ],
       "children": [
        "IPY_MODEL_e1aafd9d805f45ceb2a5a394322f71e4",
        "IPY_MODEL_76b8d887ee1a4485a5f518048cc66ef3"
       ],
       "layout": "IPY_MODEL_523f2d75879a44db95663bb6436dd05d"
      }
     },
     "e612fa032644456599e7c058fe83441c": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_b2c1fb0127ed4642ab959be57b91ab27",
       "max": 30,
       "min": -10,
       "style": "IPY_MODEL_67c6bb383b644c0b9abc04c9ae4e6a62",
       "value": 10
      }
     },
     "e66005c43b3f46a0b009c97bf618e598": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "e7bc41997974427d8f95d8f330e99fd6": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_0669fc56ae8b408e921beba3520f6d14",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "A simple math question: \"10 + 20 = ?\", the answer is 30!\n"
        }
       ]
      }
     },
     "e7e8154648c04623b0ddece5ab4c19c4": {
      "model_module": "@jupyter-widgets/output",
      "model_module_version": "1.0.0",
      "model_name": "OutputModel",
      "state": {
       "layout": "IPY_MODEL_87f892e3b1d24f95b46957bfcaef9745",
       "outputs": [
        {
         "name": "stdout",
         "output_type": "stream",
         "text": "A simple math question: \"10 + 20 = ?\", the answer is 30!\n"
        }
       ]
      }
     },
     "f2870f8d10d34b3f96d42559e9daa2bb": {
      "model_module": "@jupyter-widgets/base",
      "model_module_version": "2.0.0",
      "model_name": "LayoutModel",
      "state": {}
     },
     "f3a4cf71e0c546dbbdd3b710356a4015": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_dda5586889234abeb45556613f323c16",
       "max": 30,
       "min": -10,
       "style": "IPY_MODEL_30c6c6a8026a475fa022433c08b69516",
       "value": 10
      }
     },
     "f547b163776f400f88246dd3034af06d": {
      "model_module": "@jupyter-widgets/controls",
      "model_module_version": "2.0.0",
      "model_name": "IntSliderModel",
      "state": {
       "behavior": "drag-tap",
       "description": "x",
       "layout": "IPY_MODEL_9d2b6656488841528dc63d972cb10b07",
       "max": 90,
       "min": -30,
       "style": "IPY_MODEL_81485a719b1c4047a55aa4f9469eb9a2",
       "value": 30
      }
     }
    },
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
